package com.xm.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.xm.dao.ItemDao;
import com.xm.pojo.Item;
import com.xm.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Wrapper;
import java.util.List;
@Service
public class ItemServiceImpl implements ItemService {
    @Autowired
    ItemDao itemDao;

    @Override
    public int saveItem(Item item) {
        return itemDao.insert(item);
    }

    @Override
    public int deleteItem(Integer id) {
        return itemDao.deleteById(id);
    }

    @Override
    public int updateItem(Item item) {
        return itemDao.updateById(item);
    }

    @Override
    public List<Item> findItem(Item item) {

        return itemDao.selectList(new QueryWrapper(item));
    }

    @Override
    public Item findById(Integer id) {
        return itemDao.selectById(id);
    }
}
